public class WaterTankController {
    public static void main(String[] args) {
        WaterTank tank = new WaterTank();

        while (true) {
            try {
                Thread.sleep(2000); 

                LocalTime now = tank.getCurrentTime();
                tank.simulateWaterLevel(); 
                tank.simulateTemperatureChange(); 

                if (now.getHour() == 7 && now.getMinute() == 0) {
                    tank.handleMorning7();
                }
                if (now.getHour() == 23 && now.getMinute() == 0) {
                    tank.handleNight11();
                }

                if (tank.getTemperature() < 20 && tank.hasWater()) {
                    tank.handleTemperatureBelow20AndHasWater();
                }
                if (tank.getTemperature() >= 100) {
                    tank.handleTemperatureReached100();
                }
                if (!tank.hasWater()) {
                    tank.handleNoWater();
                }

                if (new Random().nextInt(10) == 0) {
                    tank.handleBurnedOut();
                }

                System.out.println(tank.toString());

            } catch (InterruptedException e) {
                break;
            }
        }
    }
}